]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ibusManager: Restore the NOFILE limit
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 31 Jan 2022 09:40:04 +0000 (10:40 +0100)
committerOlivier Fourdan <ofourdan@redhat.com>
Tue, 8 Feb 2022 08:25:25 +0000 (08:25 +0000)
Use GLib's spawn_async() instead of Gio.SubprocessLauncher() which does
not support the child setup function to start ibus-daemon.

This way we can restore the NOFILE limit prior to run the ibus-daemon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>

js/misc/ibusManager.js

index d9a9a9d602874a1fa3e4e9f56d77feb3db72ab19..d91342c2a8e799cd5d7bf75f694cd07843785c49 100644 (file)
@@ -70,12 +70,22 @@ var IBusManager = class {
     _spawn(extraArgs = []) {
         try {
             let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
-            let launcher = Gio.SubprocessLauncher.new(Gio.SubprocessFlags.NONE);
             // Forward the right X11 Display for ibus-x11
             let display = GLib.getenv('GNOME_SETUP_DISPLAY');
+            let env = [];
+
             if (display)
-                launcher.setenv('DISPLAY', display, true);
-            launcher.spawnv(cmdLine);
+                env.push('DISPLAY=%s'.format(display));
+            GLib.spawn_async(
+                null, cmdLine, env,
+                GLib.SpawnFlags.SEARCH_PATH,
+                () => {
+                    try {
+                        global.context.restore_rlimit_nofile();
+                    } catch (err) {
+                    }
+                }
+            );
         } catch (e) {
             log(`Failed to launch ibus-daemon: ${e.message}`);
         }